#pragma once
#include <nice2d/predef.h>
#include <nice2d/scene.h>
#include <nice2d/piece/piece.h>
#include <nice2d/piece/piecevisitor.h>

class PieceScene : public Scene
{
    DECLARE_OBJECT(PieceScene)
public:
    PieceScene();
    virtual ~PieceScene();
public:
    void setTileMap(std::shared_ptr<TileMap> tileMap);
    std::shared_ptr<TileMap> getTileMap()const;

    void addPiece(std::shared_ptr<Piece> piece, int32_t x, int32_t y);
    void removePiece(std::shared_ptr<Piece> piece);

    void movePiece(std::shared_ptr<Piece> piece, int32_t x, int32_t y);

    void selectPiece(std::shared_ptr<Piece> piece);
    void acceptPieces(std::shared_ptr<PieceVisitor> visitor);
public:
    void execute(std::shared_ptr<Action> action);
public:
    int  getCurrentRound()const;
    void onUpdateScene(float deltaTime) override;
private:
    std::unique_ptr<class PieceSceneData> data;
};
